import router from './index'
import store from '@/store'
import nprogress from 'nprogress'
nprogress.configure({showSpinner: false})
router.beforeEach((to, from, next)=>{
    nprogress.start()
    if(to.meta.islogin){
        if(store.state.token){
            next()
        }else{
            router.push({name:'Login'})
        }
    }else{
        next()
    }
})
router.afterEach(()=>{
    nprogress.done()
})